Passed
Push — master ( 33b817...bb2a4c )
by Muhammad Dyas
01:42
created

helper.ts ➔ getRandomFooter   A

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
1
function getRandomString(string: Array<string>) {
2
  return string[Math.floor(Math.random() * string.length)];
3
}
4
5
function getRandomFooter() {
6
  const footers = [
7
    'We trust that you\'ll discover our service valuable, and we encourage you to reach out to us without hesitation should you have any inquiries or apprehensions.',
8
    'We hope you find our service useful and please don\'t hesitate to contact us if you have any questions or concerns.',
9
    'We trust that our service proves valuable to you. Should you have any inquiries or apprehensions, please feel free to reach out to us without hesitation.',
10
    'We anticipate that you\'ll find our service valuable, and please don\'t hesitate to get in touch if you have any questions or concerns.',
11
    'We appreciate your usage of our application and please don\'t hesitate to contact us if you have any questions or concerns.',
12
    'Thank you for using our app. We hope you\'ll find it to be a valuable tool',
13
  ];
14
  return getRandomString(footers);
15
}
16
17
function getRandomGreet() {
18
  const greets = [
19
    'Hi there! ',
20
    'Greetings! ',
21
    'Hello, ',
22
    'Hi, ',
23
    'Yay! ',
24
  ];
25
  return getRandomString(greets);
26
}
27
28
function getRandomDescription() {
29
  const descriptions = [
30
    'I\'m here to assist you in creating polls that can improve teamwork and streamline the process of making decisions.',
31
    'I can help you create polls to enhance collaboration and efficiency in decision-making using Google Chat™.',
32
    'I can help you make polls for better teamwork using Google Chat™',
33
    'I\'m capable of assisting you in generating polls that can boost collaboration and streamline decision-making through Google Chat™.',
34
    'My purpose is to support you in crafting polls that enhance teamwork and simplify the decision-making process.',
35
    '',
36
  ];
37
  return getRandomString(descriptions);
38
}
39
40
function getRandomExample() {
41
  const examples = [
42
    '"Which is the best country to visit" "Indonesia" "Bali"',
43
    '"When should we schedule our team days?" "Monday" "Tuesday" "Wednesday"',
44
    '"What would be the ideal date for our vacation?" "30 th February" "26 th March" "15 th April"',
45
    '"Which date works best for [event]?" "30 th February" "26 th March" "15 th April"',
46
    '"Your Question" "Answer 1" "Answer 2"',
47
  ];
48
  return getRandomString(examples);
49
}
50
51
function getRandomInfo() {
52
  const info = [
53
    'This app is designed to be used within group or space rooms with multiple members. However, if you\'d like to learn more about it, you can test it in a direct message (DM) conversation here.',
54
    'This app is a collaborative tool and is intended to be used in group or space rooms with multiple members. However, you can also test it out in a direct message (DM) here to discover more about its features.',
55
    'As a collaborative application, this is intended for use in group or space rooms with multiple members. However, you can also explore and test it further in a direct message (DM) here to gain a better understanding.',
56
    'This app is meant for group/space collaboration, but you can also test it via DM for more insights',
57
    'This is a collaborative app designed for group or space rooms, but you can also test it via DM for a better grasp.',
58
    'To enhance its functionality, install this app in a group or space room with multiple members. However, you can also test it in a direct message (DM) here to learn more.',
59
  ];
60
  return getRandomString(info);
61
}
62
63
export function generateHelpText(isPrivate: boolean = false) {
64
  const greet = getRandomGreet();
65
  const description = getRandomDescription();
66
  const footer = getRandomFooter();
67
  const example = getRandomExample();
68
  const example2 = getRandomExample();
69
  let additionalMessage = '';
70
  if (isPrivate) {
71
    additionalMessage = getRandomInfo() + '\n\n';
72
  }
73
  return greet + description + '\n' +
74
    '\n' + additionalMessage +
75
    'Below is an example commands:\n' +
76
    '`/poll` - You will need to fill out the topic and answers in the form that will be displayed.\n' +
77
    '`/poll ' + example + '` - to create a poll with autofill \n' +
78
    '\n' +
79
    'Alternatively, you can create poll by mentioning me with question and answers. ' +
80
    'e.g *@Absolute Poll ' + example2 + '*\n\n' +
81
    footer;
82
}
83